package com.tjetc.controller;

import com.tjetc.common.JsonResult;
import com.tjetc.service.LikesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("like")
public class LikesController {

    @Autowired
    LikesService likesService;

    // 添加点赞 - 景点
    @RequestMapping("add/spot")
    public JsonResult addlikespot(@RequestParam("userId") Long userId, @RequestParam("spotId") Long spotId) {
        return likesService.addlikespot(userId, spotId);
    }

    // 取消点赞 - 景点
    @RequestMapping("cancel/spot")
    public JsonResult cancellikesspot(@RequestParam("bookmarkId") Long bookmarkId) {
        return likesService.cancellikesspot(bookmarkId);
    }

    // 添加点赞 - 区域
    @RequestMapping("add/region")
    public JsonResult addlikeregion(@RequestParam("userId") Long userId, @RequestParam("regionId") Long regionId) {
        return likesService.addlikeregion(userId, regionId);
    }

    // 取消点赞 - 区域
    @RequestMapping("cancel/region")
    public JsonResult cancellikeregion(@RequestParam("bookmarkId") Long bookmarkId) {
        return likesService.cancellikeregion(bookmarkId);
    }

    // 添加点赞 - 游记
    @RequestMapping("add/travelogue")
    public JsonResult addliketravelogue(@RequestParam("userId") Long userId, @RequestParam("travelogueId") Long travelogueId) {
        return likesService.addliketravelogue(userId, travelogueId);
    }

    // 取消点赞 - 游记
    @RequestMapping("cancel/travelogue")
    public JsonResult cancelliketravelogue(@RequestParam("bookmarkId") Long bookmarkId) {
        return likesService.cancelliketravelogue(bookmarkId);
    }

    // 添加点赞 - 攻略
    @RequestMapping("add/guide")
    public JsonResult addlikeguide(@RequestParam("userId") Long userId, @RequestParam("guideId") Long guideId) {
        return likesService.addlikeguide(userId, guideId);
    }

    // 取消点赞 - 攻略
    @RequestMapping("cancel/guide")
    public JsonResult cancellikeguide(@RequestParam("bookmarkId") Long bookmarkId) {
        return likesService.cancellikeguide(bookmarkId);
    }
    @RequestMapping("pan")
    public JsonResult is_like(@RequestParam("userId") Long userId, @RequestParam("bindId") Long spotId,@RequestParam("type")Long type) {
        return likesService.islike(userId,spotId,type);
    }
}
